You are here: Building the Model: General Elements > Pre-defined Tank Subroutines > Examples of Tank Control Logic > Split Transfers
Sometimes it is necessary to use a tank or separator to split the flow to several output tanks. To define the concurrent transfer of material from one tank to multiple tanks, define an activated subroutine for each transfer. Suppose, for example, that when TankA fills it begins transferring to TankB at a rate of 30 gpm and to TankC at a rate of 40 gpm. To know when both transfers are complete, define a global variable (e.g., TransferDone) which increments at the end of each transfer. Defining the following logic would initiate this split transfer once TankA is full:
Initiate split transfer
ACTIVATE TransferToB () // initiates transfers from A to B
ACTIVATE TransferToC () // initiates transfers from A to C
WAIT UNTIL TransferDone = 2 // Wait until transfers are complete
TransferDone = 0 // reset for next transfer
The subroutines TransferToB and TransferToC would each execute a Tank_TransferDownTo command followed by a statement incrementing the value of TransferDone. For example, the logic for TransferToB would be as follows:
Split transfers subroutines
TransferDownTo(TankA, TankB, 0, 30, 0)
INC TransferDone